home *** CD-ROM | disk | FTP | other *** search
/ Rockford Magazine / Rockford_Magazine_022_19xx_-_de_Disk_2_of_4_Side_B.d64 / miniature golf (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  10KB  |  360 lines

  1. 10 rem ********************
  2. 11 rem ***              ***
  3. 12 rem ** miniature golf **
  4. 13 rem ***              ***
  5. 14 rem ********************
  6. 15 :
  7. 16 :
  8. 20 gosub1000:rem instructions
  9. 30 gosub2000:rem setup
  10. 40 gosub3000:rem play!
  11. 50 gosub4000:rem !end!
  12. 60 end
  13. 70 :
  14. 1000 :
  15. 1001 :rem *** insts ***
  16. 1002 :
  17. 1003 poke53281,1:poke53280,1
  18. 1010 print"[147][152]"
  19. 1020 printtab(9)"*** miniature golf ***
  20. 1025 [153]:[153]
  21. 1030 [153]"welcome to the alberts country club.    this beautiful nine-hole ";
  22. 1031 [153]"miniature golf course is open and waiting for you !"
  23. 1035 [153]
  24. 1040 [153]"you should know the rules of the course before you begin play !"
  25. 1041 [153]
  26. 1045 [153]"to putt the ball,you have to input      which way you want to ";
  27. 1046 [153]"aim it."
  28. 1047 [153]"there are 8 directions, shown below your ball is assumed to be at *"
  29. 1050 [153]:[153][163]17)"2 1 8":[153][163]17)"3 * 7":[153][163]17)"4 5 6"
  30. 1060 [153]:[153]:[153]"press return when ready to continue"
  31. 1065 [161]x$:[139]x$[179][177][199](13)[167]1065
  32. 1070 [153]"load"
  33. 1075 [153][163]9)"*** miniature golf ***
  34. 1076 print:print
  35. 1080 print"then you must input how hard to hit the ball.  the speed should ";
  36. 1081 print"be some number  between 0.00 and 5.00.  for example, youcould";
  37. 1082 print" hit the ball a relative speed of  3.2"
  38. 1085 print
  39. 1090 print"it will take a few tries before you get used to how hard to putt ";
  40. 1095 print"the ball.":print
  41. 1100 print"also, there are four types of hazards onthe course.  you should ";
  42. 1105 print"be aware of whatthey are and what affect they have on   you ";
  43. 1106 print"and your ball."
  44. 1110 print:print:print:print"press return when ready to continue"
  45. 1115 getx$:ifx$<>chr$(13)then1115
  46. 1120 print"[147]"
  47. 1125 printtab(9)"*** miniature golf ***
  48. 1126 [153]:[153]
  49. 1130 [153]"blocks: these are like walls. you must  putt around them."
  50. 1135 [153]
  51. 1140 [153]"yellow traps represent sand.  your ball cannot penetrate through ";
  52. 1141 [153]"a sand trap.   the penalty for landing in the sand is  one stroke."
  53. 1145 [153]
  54. 1150 [153]"water: like sand, these blue hazards    will stop your ball.";
  55. 1151 [153]"  the   penalty for landing in water is one stroke."
  56. 1155 [153]
  57. 1160 [153]"uneven surfaces: these red hazards causethe ball to roll in ";
  58. 1165 [153]"a direction which isunpredictable   there is no  penalty ";
  59. 1166 [153]"forhitting this hazard."
  60. 1170 [153]:[153]:[153]"press return when ready to continue"
  61. 1175 [161]x$:[139]x$[179][177][199](13)[167]1175
  62. 1180 [153]"loadprint#"
  63. 1185 [153][163]9)"*** miniature golf ***
  64. 1186 print:print
  65. 1190 print"you are trying to sink the ball in as   few tries as possible.  ";
  66. 1191 print"the hole is the black square."
  67. 1195 print
  68. 1200 print"if you hit the ball too hard, it will   jump over the hole and ";
  69. 1205 print"continue rolling.it may also change direction, so be sureto hit ";
  70. 1206 print"the ball just hard enough."
  71. 1210 print:print:print"press return when ready to continue"
  72. 1215 getx$:ifx$<>chr$(13)then1215
  73. 1990 return
  74. 2000 :
  75. 2001 :rem *** setup ***
  76. 2002 :
  77. 2010 dimha(9,5):fori=1to9:forj=1to5:readha(i,j):next:next
  78. 2011 data 0,0,0,0,2
  79. 2012 data 1,0,0,0,3
  80. 2013 data 0,1,0,0,3
  81. 2014 data 1,1,0,0,3
  82. 2015 data 0,0,0,1,3
  83. 2016 data 0,0,1,1,3
  84. 2017 data 1,0,1,0,3
  85. 2018 data 0,1,1,0,4
  86. 2019 data 0,0,1,1,3
  87. 2020 dimdi(8,2):fori=1to8:readdi(i,1),di(i,2):next
  88. 2025 data 0,-1, -1,-1, -1,0, -1,1, 0,1, 1,1, 1,0, 1,-1
  89. 2030 plt=49152:fori=0to24:readc:pokeplt+i,c:nexti
  90. 2031 data32,16,192,132
  91. 2032 data253,32,16,192
  92. 2033 data152,170,164,253
  93. 2034 data24,76,240,255
  94. 2035 data32,253,174,32
  95. 2036 data158,173,76,170,177
  96. 2040 dimv(8):fori=1to8:readv(i):next:data-40,-41,-1,39,40,41,1,-39
  97. 2050 :
  98. 2055 def fnco(x)=peek(55296+bx+40*by+x)and15
  99. 2060 def fnsc(x)=peek(1024+bx+40*by+x)
  100. 2090 return
  101. 2100 rem *** hole 1 ***
  102. 2105 gosub2050
  103. 2106 print""
  104. 2110 printtab(10)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  105. 2112 fori=1to15
  106. 2115 printtab(10)"[161]                 [146][144][161]"
  107. 2120 next
  108. 2125 printtab(10)"[144][188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  109. 2130 print""tab(19)" "
  110. 2135 by=16:bx=11+int(17*rnd(0)):sysplt,bx,by:print"[209]";
  111. 2140 return
  112. 2200 rem *** hole 2 ***
  113. 2205 gosub2050
  114. 2206 print""
  115. 2210 printtab(8)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  116. 2212 fori=1to5
  117. 2215 printtab(8)"[161]                          [146][144][161]"
  118. 2220 next
  119. 2221 printtab(8)"[161]                [144][172][162][162][162][162][162][162][162][162][162][146][190]"
  120. 2222 printtab(8)"[161]                [146][144][161]"
  121. 2223 printtab(8)"[161]                [146][144][161]"
  122. 2224 printtab(8)"[161]                [146][144][161]"
  123. 2225 printtab(8)"[161]                [146][144][161]"
  124. 2226 fori=1to6
  125. 2227 printtab(8)"[161]                [146][144][161]"
  126. 2230 next
  127. 2235 printtab(8)"[188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  128. 2240 by=17:bx=9+int(15*rnd(0)):sysplt,bx,by:print"[209]";
  129. 2245 print""tab(30)"[144] "
  130. 2250 return
  131. 2300 rem *** hole 3 ***
  132. 2306 print""
  133. 2310 printtab(20)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  134. 2312 fori=1to5
  135. 2315 printtab(20)"[161]                [146][144][161]"
  136. 2320 next
  137. 2321 printtab(8)"[146][172][162][162][162][162][162][162][162][162][162][162][162][190]                [146][144][161]"
  138. 2322 printtab(8)"[161]                            [146][144][161]"
  139. 2323 printtab(8)"[161]                     [158]       [146][144][161]"
  140. 2324 printtab(8)"[161]                    [158]        [146][144][161]"
  141. 2325 printtab(8)"[161]                    [158]        [146][144][161]"
  142. 2326 printtab(8)"[161]                     [158]       [146][144][161]"
  143. 2335 printtab(8)"[161]                [144][172][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  144. 2340 fori=1to4
  145. 2345 printtab(8)"[161]                [146][144][161]"
  146. 2350 next
  147. 2355 printtab(8)"[146][188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  148. 2360 print""tab(32)"[144] "
  149. 2365 by=17:bx=9+int(15*rnd(0)):sysplt,bx,by:print"[209]"
  150. 2390 return
  151. 2400 rem *** hole 4 ***
  152. 2406 print""
  153. 2410 printtab(7)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  154. 2412 fori=1to6
  155. 2415 printtab(7)"[161]                             [146][144][161]"
  156. 2420 next
  157. 2421 printtab(7)"[161]       [144][172][162][162][162][162][162][162][162][162][162][187][146]           [146][144][161]"
  158. 2425 fori=1to4
  159. 2430 printtab(7)"[161]       [144][146][161]         [161]           [146][144][161]"
  160. 2435 next
  161. 2440 printtab(7)"[161]       [144][188][146][162][162][162][187]     [188][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  162. 2445 fori=1to3
  163. 2450 printtab(7)"[161]           [144][146][161]"
  164. 2455 next
  165. 2460 printtab(7)"[188][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  166. 2465 print""tab(18)"[158]        [157][157][157][157][157][157]      [157][157][157][157] "
  167. 2470 printtab(25)" [157][157][157]    [157][157][157][157][157]      [157][157]  "
  168. 2475 sysplt,32,10:print"[144] "
  169. 2480 by=16:bx=8+int(10*rnd(0)):sysplt,bx,by:print"[209]"
  170. 2490 return
  171. 2500 rem *** hole 5 ***
  172. 2505 print""
  173. 2506 print""
  174. 2510 printtab(10)"[144][172][162][162][162][162][163][255][255][255][255][163][255][255][255][255][162][162][162][162][162][162][162][162][187]"
  175. 2512 fori=1to15
  176. 2515 printtab(10)"[161]                        [146][144][161]"
  177. 2520 next
  178. 2525 printtab(10)"[144][188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  179. 2530 sysplt,19,6:print"[173][195][195][195][195][195][189]"
  180. 2535 sysplt,22,4:print"[144] "
  181. 2540 by=16:bx=11+int(23*rnd(0)):sysplt,bx,by:print"[209]"
  182. 2590 return
  183. 2600 rem *** hole 6 ***
  184. 2605 gosub2050
  185. 2606 print""
  186. 2610 printtab(8)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  187. 2612 fori=1to7
  188. 2615 printtab(8)"[161]                         [146][144][161]"
  189. 2620 next
  190. 2625 printtab(8)"[161]               [144][172][162][162][162][162][162][162][162][162][162][146][190]"
  191. 2630 fori=1to7
  192. 2635 printtab(8)"[161]               [146][144][161]"
  193. 2640 next
  194. 2645 printtab(8)"[188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  195. 2650 sysplt,27,4:print"[176][157][194][157][173]"
  196. 2655 sysplt,20,5:print"    [157][157][157][157][157][157]       [157][157][157][157][157]    [157][157]  "
  197. 2660 sysplt,30,5:print"[144] "
  198. 2665 by=16:bx=9+int(15*rnd(0)):sysplt,bx,by:print"[209]"
  199. 2690 return
  200. 2700 rem *** hole 7 ***
  201. 2706 print""
  202. 2710 printtab(8)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  203. 2712 fori=1to4
  204. 2715 printtab(8)"[161]            [146][144][161]"
  205. 2720 next
  206. 2721 printtab(8)"[161]            [144][188][146][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  207. 2725 fori=1to4
  208. 2727 printtab(8)"[161]                             [144][146][161]"
  209. 2730 next
  210. 2735 printtab(8)"[144][188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]             [144][146][161]"
  211. 2740 fori=1to5
  212. 2745 printtab(24)"[144][161]             [144][146][161]"
  213. 2750 next
  214. 2755 printtab(24)"[144][188][162][162][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  215. 2760 sysplt,9,7:print"    [157][157][157][157]     [157][157][157][157]      [157][157][157][157][157]        "
  216. 2765 sysplt,27,7:print"         [157][157][157][157][157][157]       [157][157][157][157][157][157]      [157][157][157][157][157][157][157]       "
  217. 2770 sysplt,13,4:print"[144] "
  218. 2775 by=16:bx=25+int(13*rnd(0)):sysplt,bx,by:print"[209]"
  219. 2799 return
  220. 2800 rem *** hole 8 ***
  221. 2806 print""
  222. 2810 printtab(7)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  223. 2812 fori=1to6
  224. 2815 printtab(7)"[161]                             [146][144][161]"
  225. 2820 next
  226. 2821 printtab(7)"[161]          [144][172][162][162][162][162][162][162][162][187]          [146][144][161]"
  227. 2825 fori=1to4
  228. 2830 printtab(7)"[161]          [144][146][161]       [161]          [146][144][161]"
  229. 2835 next
  230. 2840 printtab(7)"[188][162][162][162][162][162][162][162][162][162][162][146][190]       [161]          [144][146][161]"
  231. 2845 fori=1to3
  232. 2850 printtab(26)"[161]          [144][146][161]"
  233. 2855 next
  234. 2860 printtab(26)"[188][162][162][162][162][162][162][162][162][162][162][146][190]"
  235. 2865 sysplt,28,2:print"         "
  236. 2866 sysplt,29,3:print"        "
  237. 2867 sysplt,30,4:print"       "
  238. 2868 sysplt,30,5:print"       "
  239. 2869 sysplt,32,6:print"     "
  240. 2870 sysplt,33,7:print"   "
  241. 2875 sysplt,13,3:print"[158]   [157][157][157][157]     [157][157][157][157][157]     [157][157][157][157]   "
  242. 2880 sysplt,13,10:print"[144] "
  243. 2885 by=16:bx=27+int(10*rnd(0)):sysplt,bx,by:print"[209]"
  244. 2890 return
  245. 2900 rem *** hole 9 ***
  246. 2905 gosub2050
  247. 2906 print""
  248. 2910 printtab(8)"[144][172][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][187]"
  249. 2912 fori=1to9
  250. 2915 printtab(8)"[161]                           [146][144][161]"
  251. 2920 next
  252. 2921 printtab(8)"[188][162][162][162][162][162][162][162][162][162][162][162][187]               [146][144][161]"
  253. 2925 fori=1to5
  254. 2927 printtab(20)"[161]               [146][144][161]"
  255. 2930 next
  256. 2935 printtab(20)"[188][162][162][162][162][162][162][162][162][162][162][162][162][162][162][162][146][190]"
  257. 2940 sysplt,21,2:print"               "
  258. 2941 sysplt,22,3:print"              "
  259. 2942 sysplt,23,4:print"             "
  260. 2943 sysplt,24,5:print"            "
  261. 2944 sysplt,25,6:print"           "
  262. 2950 sysplt,11,6:print"[144] "
  263. 2955 sysplt,14,5:print"[174][157][194][157][189]"
  264. 2960 by=16:bx=21+int(15*rnd(0)):sysplt,bx,by:print"[209]"
  265. 2990 return
  266. 3000 :
  267. 3001 :rem *** play ***
  268. 3002 :
  269. 3010 forho=1to9:bc$=""
  270. 3015 print"[147]";
  271. 3020 onhogosub2100,2200,2300,2400,2500,2600,2700,2800,2900
  272. 3030 print"[154]hole number:"ho"par:"ha(ho,5)"score:"sc
  273. 3031 print:print"traps:":ifha(ho,1)thenprint"water"
  274. 3032 ifha(ho,2)thenprint"[158]sand"
  275. 3033 ifha(ho,3)thenprint"uneven"
  276. 3034 ifha(ho,4)thenprint"[144]blocks"
  277. 3035 print:print"[144]2 1 8":print"3 [209] 7":print"4 5 6"
  278. 3036 sysplt,0,19:fori=1to5:print"                                     ":next
  279. 3038 d$="":sysplt,0,20:input"direction (1-8)";d$:dir=val(d$)
  280. 3040 ifdir>0anddir<9anddir=int(dir)then3045
  281. 3041 print"the direction is from 1 to 8 ...":forpa=1to1500:next:goto3036
  282. 3045 sysplt,0,19:fori=1to5:print"                                     ":next
  283. 3046 d$="":sysplt,0,20:input"speed (0-5)";d$:sp=val(d$)
  284. 3050 ifsp=>0andsp<=5then3055
  285. 3051 print"the speed is from 0 to 5...":forpa=1to1500:next:goto3045
  286. 3055 uf=0:rem clear uneven flag
  287. 3056 tf=0:rem clear trap flag
  288. 3100 x2=bx+di(di,1):y2=by+di(di,2)
  289. 3110 d2=v(di):co=fnco(d2):ifco<>5orfnsc(d2)<>160then3120
  290. 3115 sysplt,bx,by:printbc$" ";:bx=x2:by=y2:sysplt,bx,by:print"[209]";
  291. 3116 bc$="":goto3900
  292. 3120 ifco=0andfnsc(d2)<>160then3200:rem hit a wall
  293. 3121 ifco=6then3300:rem water
  294. 3122 ifco=7then3400:rem sand
  295. 3123 ifco=2then3500:rem uneven
  296. 3124 ifco=0then3600:rem the hole
  297. 3200 ifdi=1ordi=3thendi=di+4:goto3100
  298. 3201 ifdi=7ordi=5thendi=di-4:goto3100
  299. 3210 ondi/2goto3220,3240,3260,3280
  300. 3220 iffnsc(d2+1)<>160andfnsc(d2+40)<>160thendi=6:goto3100
  301. 3225 iffnsc(d2+1)<>160thendi=4:goto3100
  302. 3230 iffnsc(d2+40)<>160thendi=8:goto3100
  303. 3235 di=6:goto3100
  304. 3240 iffnsc(d2+1)<>160andfnsc(d2-40)<>160thendi=8:goto3100
  305. 3245 iffnsc(d2+1)<>160thendi=2:goto3100
  306. 3250 iffnsc(d2-40)<>160thendi=6:goto3100
  307. 3255 di=8:goto3100
  308. 3260 iffnsc(d2-1)<>160andfnsc(d2-40)<>160thendi=2:goto3100
  309. 3265 iffnsc(d2-1)<>160thendi=8:goto3100
  310. 3270 iffnsc(d2-40)<>160thendi=4:goto3100
  311. 3275 di=2:goto3100
  312. 3280 iffnsc(d2-1)<>160andfnsc(d2+40)<>160thendi=4:goto3100
  313. 3285 iffnsc(d2-1)<>160thendi=6:goto3100
  314. 3290 iffnsc(d2+40)<>160thendi=2:goto3100
  315. 3295 di=4:goto3100
  316. 3300 iftfthen3310
  317. 3305 tf=3:sc=sc+1:rem trap flag
  318. 3310 sysplt,bx,by:printbc$" ";
  319. 3315 bx=x2:by=y2:sysplt,bx,by:print"[209]";:bc$=""
  320. 3320 goto3900
  321. 3400 iftfthen3410
  322. 3405 tf=3:sc=sc+1:rem trap flag
  323. 3410 sysplt,bx,by:printbc$" ";
  324. 3415 bx=x2:by=y2:sysplt,bx,by:print"[158][209]";:bc$="[158]"
  325. 3420 goto3900
  326. 3500 ifufthen3520
  327. 3505 uf=1:rem uneven flag, have re rolled ball off course yet?...
  328. 3510 di=di+2*int(2*rnd(0))-1
  329. 3515 ifdi=0theni=8
  330. 3516 ifdi=9theni=1
  331. 3520 sysplt,bx,by:printbc$" ";
  332. 3525 bx=x2:by=y2:sysplt,bx,by:print"[209]";:bc$=""
  333. 3530 goto3900
  334. 3600 sysplt,bx,by:print" ":sysplt,x2,y2:print" "
  335. 3601 sysplt,x2,y2:print"[144] ";
  336. 3602 di=di+2*int(2*rnd(0))-1
  337. 3604 ifdi=0thendi=8
  338. 3605 ifdi=9thendi=1
  339. 3606 sp=sp-.5:ifsp>0thenx2=x2+di(di,1):y2=y2+di(di,2):goto3110
  340. 3610 sc=sc+1:goto3990
  341. 3900 :
  342. 3902 iftf>0thentf=tf-1:iftf=0then3910
  343. 3905 sp=sp-.3:ifsp>0then3100
  344. 3910 sc=sc+1:goto3030
  345. 3980 getx$:ifx$=""then3980
  346. 3990 nextho:return
  347. 4000 :
  348. 4001 :rem *** end ***
  349. 4002 :
  350. 4005 forpa=1to200:nextpa
  351. 4010 print"[147]";tab(9)"*** miniature golf ***"
  352. 4015 print:print:print:print
  353. 4020 print"the game is over !"
  354. 4022 print
  355. 4025 print"on the par 27 course, you shot":print"a round of"sc". that is an"
  356. 4026 print"average of"int(sc*100/9)/100"shots per hole."
  357. 4030 print:print:print
  358. 4035 print"hope you enjoyed the game!"
  359. 4990 return
  360.